﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Management;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace ExcelSystem.ToolHelper
{
    public static class Print
    {
        public static void AvailablePrinters()
        {
            ManagementScope ms = new ManagementScope(ManagementPath.DefaultPath);
            ms.Connect();

            SelectQuery sq = new SelectQuery();
            sq.QueryString = @"SELECT Name FROM Win32_Printer";

            ManagementObjectSearcher mos =
               new ManagementObjectSearcher(ms, sq);
            ManagementObjectCollection oObjectCollection = mos.Get();

            foreach (ManagementObject mo in oObjectCollection)
                MessageBox.Show(mo["Name"].ToString());

        }
    }
}
